package com.note.simpleadmin.module.system.vo;

import com.note.simpleadmin.entity.BgMenu;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/***
 *@ClaseName:BgMenuVo
 *
 *@Decription:
 *
 *@Author: xubingbing
 *
 *@Date:2019/1/27 0027 19:47
 */
public class BgMenuVo implements Serializable {
    private String id;
    private String code;
    private String name;
    private Integer sort;
    private String icon;
    private String url;
    private List<BgMenuVo> childrens;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public List<BgMenuVo> getChildrens() {
        return childrens;
    }

    public void setChildrens(List<BgMenuVo> childrens) {
        this.childrens = childrens;
    }
    public static BgMenuVo newInstance(BgMenu menu)
    {
        BgMenuVo menuVo=new BgMenuVo();
        menuVo.setId(menu.getId());
        menuVo.setCode(menu.getCode());
        menuVo.setName(menu.getName());
        menuVo.setSort(menu.getSort());
        menuVo.setIcon(menu.getIcon());
        menuVo.setUrl(menu.getUrl());
        return menuVo;
    }
    public static List<BgMenuVo>copy(List<BgMenu> list)
    {
        List<BgMenuVo> menuVoList=new ArrayList<BgMenuVo>();
        for(BgMenu bgMenu:list)
        {
            BgMenuVo bgMenuVo= BgMenuVo.newInstance(bgMenu);
            menuVoList.add(bgMenuVo);
        }
        return  menuVoList;
    }
}
